package com.cloud.code.牛客网;

import java.util.Scanner;

public class Test3 {

//    public static void main(String[] args) {
//        Scanner in = new Scanner(System.in);
//        // 注意 hasNext 和 hasNextLine 的区别
//        while (in.hasNextInt()) { // 注意 while 处理多个 case
//            String str = in.nextLine();
//            int length = str.length() - str.lastIndexOf(" ") - 1;
//            System.out.println(length);
//        }
//    }



    public static void main(String[] args) {
        System.out.println(Integer.MIN_VALUE);
        Scanner in = new Scanner(System.in);
        String text = in.nextLine();
        char a = in.next().charAt(0);
        char[] tes = text.toCharArray();
        int cout = 0;
        for(char temp : tes){
            if(a == temp){
                cout ++;
            }
        }
        System.out.println(cout);
    }
}

